#define _CRT_SECURE_NO_WARNINGS 1


#include<stdio.h>
#include<stdlib.h>


int main()
{
    int** p = (int**)malloc(3 * sizeof(int*));
    if (p == NULL)
    {
        perror("malloc");
        return 1;
    }
    int i = 0, j = 0, temp = 1;
    for (i = 0; i < 3; i++)
    {
        p[i] = (int*)malloc(sizeof(int) * 5);
        if (p[i] == NULL)
        {
            perror("malloc");
            return 1;
        }
    }
    for (i = 0; i < 3; i++)
    {
        for (j = 0; j < 5; j++)
        {
            *(*(p + i) + j) = temp++;
            printf("%d ", *(*(p + i) + j));
        }
        printf("\n");
    }
    for (i = 0; i < 3; i++)
        free(p[i]);
    free(p);
    p = NULL;
    
    return 0;
}